package com.atguigu.tingshu.account.service;

import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.account.UserAccount;
import com.atguigu.tingshu.vo.account.AccountLockResultVo;
import com.atguigu.tingshu.vo.account.AccountLockVo;
import com.baomidou.mybatisplus.extension.service.IService;

import java.math.BigDecimal;

public interface UserAccountService extends IService<UserAccount> {

    /**
     * 获取可用金额
     * @return 可用金额
     */
    BigDecimal getAvailableAmount();

    /**
     * 校验余额并锁定账户
     * @param accountLockVo 锁定账户信息
     * @return 锁定账户结果
     */
    Result<AccountLockResultVo> checkAndLockAccount(AccountLockVo accountLockVo);

    /**
     * 账户日志
     * @param userId 用户id
     * @param title 消费标题
     * @param tradeType 消费类型
     * @param amount 消费金额
     * @param orderNo 订单号
     */
    void logs(Long userId, String title, String tradeType, BigDecimal amount, String orderNo);
}
